package cn.fivestars.springcloud.stream.service.impl;

import cn.fivestars.springcloud.stream.kafka.InputBinder;
import cn.fivestars.springcloud.stream.service.IMessageReceiver;
import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.kafka.support.JacksonUtils;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;

import javax.annotation.Resource;

/**
 * Message receive
 *
 * @author liangchenzhou1024 @163.com
 * @date 2021 /3/14
 */
@EnableBinding(InputBinder.class) // 定义消息的推送管道
@Slf4j
public class MessageReceiveImpl implements IMessageReceiver {


    @Override
    @StreamListener(InputBinder.NAME)
    public void receive(String message) {
        log.info("receive message={}", message);
    }
}
